<template>
  <div class="lineEchart" style="width: 100%; height: 100%" ref="line">
    折线图
  </div>
</template>


<script>
import * as echarts from "echarts";
export default {
  name: "LineEchart",
  components: {},
  data() {
    return {};
  },
  mounted() {
    let myechart = echarts.init(this.$refs.line);
    /** @type EChartsOption */
    myechart.setOption({
      xAxis: {
        show: false,
        type: "category",
      },
      yAxis: {
        show: false,
      },
      grid: { left: 0 },
      series: [
        {
          type: "line",
          data: [10, 7, 33, 12, 35, 9, 29, 10, 44],
          //折线图拐点样式
          itemStyle: {
            opacity: 0,
          },
          //平滑线处置
          smooth: true,
          //折线图颜色
          lineStyle: {
            color: "purple",
          },
          areaStyle: {
            color: {
              type: "linear",
              x: 0,
              y: 0,
              x2: 0,
              y2: 1,
              colorStops: [
                {
                  offset: 0,
                  color: "purple", // 0% 处的颜色
                },
                {
                  offset: 1,
                  color: "#fff", // 100% 处的颜色
                },
              ],
              global: false, // 缺省为 false
            },
          },
        },
      ],
    });
  },
};
</script>


<style scoped>
</style>